﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class StrategicPlan_ModifyStrategicPlan : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Bind();
        }
    }

    void Bind()
    {
        int StrategicPlanId = Utility.HttpHelp.getParamsInt("StrategicPlanId");
        object[] _value = new object[1];
        _value[0] = StrategicPlanId;
        DataTable dt = new BLL.StrategicPlanMgr().get(BLL.StrategicPlanMgr.field.StrategicPlanId.ToString(), _value);
        if (dt.Rows.Count > 0)
        {
            this.txtCompleteTime.Text = Convert.ToDateTime(dt.Rows[0]["CompleteTime"].ToString()).ToString("yyyy-MM-dd");
            this.txtEvaluatePeople.Value = dt.Rows[0]["EvaluatePeople"].ToString();
            this.txtMasterDepartment.Text = dt.Rows[0]["MasterDepartment"].ToString();
            this.txtMasterPeople.Value = dt.Rows[0]["MasterPeople"].ToString();
            this.txtRemark.Text = dt.Rows[0]["Remark"].ToString();
            this.txtSlaveDepartment.Value = dt.Rows[0]["SlaveDepartment"].ToString();
            this.txtSlaveDepartmentDuty.Text = dt.Rows[0]["SlaveDepartmentDuty"].ToString();
            this.txtStartTime.Text = Convert.ToDateTime(dt.Rows[0]["StartTime"].ToString()).ToString("yyyy-MM-dd");
            this.txtStrtegicPlanSortId.Value = dt.Rows[0]["StrategicPlanSortId"].ToString();
            this.txtWorkItem.Text = dt.Rows[0]["WorkItem"].ToString();



        }
    }

    protected void btnModify_Click(object sender, EventArgs e)
    {
        object[] _value = new object[11];
        _value[0] = Utility.HttpHelp.getParamsInt("StrategicPlanId");
        _value[1] = this.txtStrtegicPlanSortId.Value;
        _value[2] = Convert.ToDateTime(this.txtStartTime.Text);
        _value[3] = Convert.ToDateTime(this.txtCompleteTime.Text);
        _value[4] = this.txtWorkItem.Text;
        _value[5] = this.txtMasterDepartment.Text;
        _value[6] = this.txtMasterPeople.Value;
        _value[7] = this.txtSlaveDepartment.Value;
        _value[8] = this.txtSlaveDepartmentDuty.Text;
        _value[9] = this.txtEvaluatePeople.Value;
        _value[10] = this.txtRemark.Text;
        int val = new BLL.StrategicPlanMgr().Update(_value);
        if (val > 0)
        {
            Utility.HttpHelp.closeWindow("StrategicPlanList.aspx?Depart=" + Utility.HttpHelp.getParamsString("Depart"), Page);
        }
        else
        {
            Utility.HttpHelp.alert("修改失败", Page);
        }
    }
}